package com.geez.bbl.db.type;

import java.util.ArrayList;
import java.util.List;

/**
 * User: biniam.gebremichael
 * Date: Sep 7, 2010
 */
public class BblChapter {

    private int id;
    private Status status = Status.OK;
    private List<String> message;
    private List<Verse> verses = new ArrayList<Verse>();

    public BblChapter(int id, Status status, List<String> message, List<Verse> verses) {
        this.id = id;
        this.status = status;
        this.message = message;
        this.verses = verses;
    }

    public int getId() {
        return id;
    }

    public List<Verse> getVerses() {
        return verses;
    }

     public Verse getVerse(int start, int end) {
         for (Verse verse : verses) {
                         if (verse.getStartId()>=start && verse.getEndId()<=end){
                             return verse;
                         }
         }
         return null;
    }

    public void addVerse(Verse v){
        verses.add(v);
    }


    public Status getStatus() {
        return status;
    }

    public String getMessage() {
        if (getStatus() != Status.OK)
            return "'"+message.toString()+"'";
        else
        return null;
    }
}
